﻿<%@ page contentType="text/html;charset=utf-8" language="java"%>
<%@ page import="java.util.*" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html> 
	<head>
		<META http-equiv=Content-Type content="text/html; charset=utf-8">
		<LINK href="./styles/sciencee.css"  type=text/css rel=stylesheet>
		<LINK href="../styles/sciencee.css"  type=text/css rel=stylesheet>
		<style type="text/css">
		.STYLE1 {color: #FFFFFF}
        </style>
		<title>CGProject</title>
		<html:base/>
<%
	String cpath=request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+cpath+"/";
	String proId=(String)session.getAttribute("ProjectID");
%>
	
<script language="javascript">

function changeProject(){
	
	var a=document.getElementById("project").value;
	top.location.href="<%=cpath%>"+"/changeProject.do?proId="+a;
}
function changeENG(){
	top.location.href="<%=cpath%>"+"/changeLan.do?lang=en";
}
function changeCH(){
	top.location.href="<%=cpath%>"+"/changeLan.do?lang=ch";
}
</script>
	</head>
	<body topmargin="0">
	
		<table width="100%" background="../imagewang/bg.jpg" style="border-bottom:1px solid #000000" height="1%">
		<tr>
		<td width="5%" align="right" valign="bottom"><a  href="javascript:top.location.href='<%=basePath%>backup.do'">[<bean:message key="login.up"/>]</a></td>
			<td width="16%" align="right" valign="bottom">
			  <span class="STYLE1">
			  <bean:message key="selectproject"/>
			  ：<select id="project" name="project" onChange="changeProject();">
			    <option value="">-
		        <bean:message key="select"/>
		        -</option>
		        <%
		        
		        String lastProjectId="";
		        boolean accessFlag = false ; //选中项目是否在可参与列表中的判断
		        if (request.getAttribute("pros") !=null)
		        {
					LinkedList lnlist=(LinkedList)request.getAttribute("pros");
		        
					
					for(Iterator iter=lnlist.iterator();iter.hasNext();){
						String s[]=(String[])iter.next();
						lastProjectId=s[0];
						if ( s[0].equals(proId) ) accessFlag=true; //包含了即可访问
			 %>
			      <option value="<%=s[0]%>"><%=s[1]%></option>
		        <%}   //end "for"
		        }    //end "if"    
		         %>  
		        </select>
              </span> </td>
		    <td width="1%"></td>
        <td width="14%"  valign="bottom">
	 	   <input type="button" onClick="window.open('<%=cpath %>/project/initProject.jsp','newProject','top=150,left=150,scrollbars=yes,dialog=yes,modal=yes,width=800,height=545,resizable=yes')" value="<bean:message key="addproject"/>" >&nbsp;&nbsp;
		</td>
			<td width="3%"  valign="bottom"></td>
			<td width="15%"  valign="bottom"><span class="STYLE1">
	      <logic:notEmpty name="proName"><bean:message key="project"/><bean:message key="name"/>:<bean:write name="proName"/></logic:notEmpty></span></td>
			<td width="25%" align="right" valign="bottom"><span class="STYLE1">
		    
	        <a href="../personal/index.do" target="_blank" title="Personal">
	      <bean:message key="reguser"/>
	      ：<%=request.getAttribute("ReguserName") %></a></span></td>
			<td width="17%" align="right" valign="bottom"><input type="button" onClick="changeENG();" value="English" >
		  <input type="button" onClick="changeCH();" value="中文版 " ></td>
		  	
			<td width="4%" align="right" valign="bottom">
			
			<a href="javascript:top.location.href='<%=basePath%>logout.do'" onClick="return confirm('<bean:message key="confirmlogout"/>')">[<bean:message key="logout"/>]</a>
			</td>
		</tr>
	</table>
		<%
		
		if(proId!=null){
			Cookie cookie=new Cookie("projectId",proId);
			cookie.setMaxAge(999999);
			response.addCookie(cookie);
		}else{
			session.setAttribute("ProjectID",lastProjectId);
			Cookie cookie=new Cookie("projectId",lastProjectId);
			cookie.setMaxAge(999999);
			response.addCookie(cookie);
		}
	
		%>
	
	
	</body>
	
</html:html>